﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;
using UBConDemo.Models;
using System.Reflection;
using System.Windows.Controls;
using UBConDemo.Views.Ribbon;

namespace UBConDemo.Converters
{
    public class UriToControlConverter:IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) 
            {
                return null;
            }

            UbConItemModel model = value as UbConItemModel;
            
            return GetUserControl(model.ViewType);
        }

        private UserControl GetUserControl(string _viewType) 
        {
            UserControl _control=null;
            switch (_viewType) 
            {
                case "RibbonBarView":
                    _control = new RibbonBarView();
                    break;

            }

            return _control;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
